<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<label>投保详情页面</label><br/><br/><br/>
	
	选择产品<br/>
	
	<form action="/calculatePremium" method="post">
		<input type="hidden" name="productId" value="${productResult.id }"/>
		<br>
		<c:forEach items="${productResult.insuranceList}" var="insurance" varStatus="productStatus">
			<input type="hidden" name="subInsuranceDetails[${Integer.valueOf(productStatus.index)}].insuranceId" value="${insurance.id}">
			<input type="hidden" name="subInsuranceDetails[${Integer.valueOf(productStatus.index)}].subInsuranceName" value="${insurance.insuranceName}">
			动态展示字段1：<input type="text" name="subInsuranceDetails[${Integer.valueOf(productStatus.index)}].backup1" ><br/>
			动态展示字段2：<input type="text" name="subInsuranceDetails[${Integer.valueOf(productStatus.index)}].backup2" ><br/>
			<div>
				险种名称：${insurance.insuranceName }<br/>
				计算公式：${insurance.formulaDesc }<br/>
				<c:forEach items="${insurance.factors}" var="factor" varStatus="factorStatus">
					<input type="hidden" name="policyFactors[${Integer.valueOf(productStatus.index)*maxFactorNum+Integer.valueOf(factorStatus.index)}].factorId" value="${factor.id}"/>
					<input type="hidden" name="policyFactors[${Integer.valueOf(productStatus.index)*maxFactorNum+Integer.valueOf(factorStatus.index)}].factorName" value="${factor.factorName}"/>
					<input type="hidden" name="policyFactors[${Integer.valueOf(productStatus.index)*maxFactorNum+Integer.valueOf(factorStatus.index)}].feeOrfacotr" value="${factor.feeOrfacotr}"/>
					<input type="hidden" name="policyFactors[${Integer.valueOf(productStatus.index)*maxFactorNum+Integer.valueOf(factorStatus.index)}].insuranceId" value="${insurance.id}"/>
					<ul>
						${factor.factorName}<br/>
						<c:if test="${factor.factorDataType==1 }">
							<li>
								基础保费${factor.value} <br/>
							</li>
						</c:if>
						<c:if test="${factor.factorDataType==3 }">
						</c:if>
						<c:if test="${factor.factorDataType==4 }">
							<li>
								请输入<input type="text" name="policyFactors[${Integer.valueOf(productStatus.index)*maxFactorNum+Integer.valueOf(factorStatus.index)}].factorOptionValue"/>  <br/>
							</li>
						</c:if>
						<c:if test="${factor.factorDataType==2 }">
							<c:forEach items="${factor.factorOptions}" var="factorOption" varStatus="optionStatus">
							<li>
								<input type="radio" name="policyFactors[${Integer.valueOf(productStatus.index)*maxFactorNum+Integer.valueOf(factorStatus.index)}].factorOptionId" value="${factorOption.id}">
								&nbsp&nbsp ${factorOption.coName} &nbsp&nbsp ${factorOption.coValue }&nbsp&nbsp${factorOption.ctName } &nbsp&nbsp ${factorOption.ctValue} &nbsp&nbsp
								基础保费${factorOption.value} <br/>
							</li>
							</c:forEach>
						</c:if>
					</ul>
				</c:forEach>
			</div><br/><br/><br/>
		</c:forEach> 
		
		<%-- ${productResult.insuranceList[0].insuranceName}
		${productResult.productName }
	 --%>
		
		<%-- <select name="productId">
					<c:forEach items="${productList}" var="product">
						<option value="${product.id }" >${product.productName }</option>
					</c:forEach>
		</select> --%>
		<input type="submit">
	</form>
		
</body>
</html>